let uu=document.querySelector('#container');
let el="";
fetch("http://chst.vip:1234/api/getinlanddiscount")
.then(body=>body.json())
.then(res=>{
    // console.log(res)
    res.result.forEach(item=>{
        let regExp=/^<[^<]+\s+src="([^''""]*)"/;
        let r=item.productImg.match(regExp);
        console.log(r)
        el+=`<li productid="${item.productId}">
        <a href="#">
           <div class="image"> <img src="${r[1]}" alt="${item.productName}" width="140" height="140" productid="${item.productId}"></div>
            <div class="title">${item.productName}</div>
            <p class="price">${item.productPrice}</p>
            <p class="from">${item.productFrom}|${item.productTime}</p>
        </a>
    </li>`
    })
    uu.innerHTML=el;
})

uu.onclick=function(e){
    if(e.target.localName='li'){
        let _this=e.target;
        let id=_this.getAttribute('productid');
        console.log(id)
        location.href="./../pages/inlanddiscount_detail.html?productid="+id;
    }
} 